package com.os.web.controller;

import com.os.domain.DemoObj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Matt
 * @Date 2022-01-16
 * @Desc:
 * @Version V1.0
 */
@RestController
@RequestMapping("/rest")
public class DemoRestController {

    @RequestMapping(value = "/getJson", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public DemoObj getJson(DemoObj obj){
        return new DemoObj(obj.getId() + 1, obj.getName() + "yy");
    }

    @RequestMapping(value="/getXml", produces = {"application/xml;charset=UTF-8"})
    public DemoObj getXml(DemoObj obj){
        return new DemoObj(obj.getId() + 1, obj.getName() + "yy");
    }
}
